﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddContatos.aspx.cs" Inherits="NewTierra.Pages.AddContatos" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="../../Styles/EstiloGeral.css" rel="stylesheet" type="text/css" />

    <title></title>
    <style type="text/css">
        #FormContatos
        {
            height: 297px;
            width: 899px;
        }
        
        #FormContatos .GridContatos
        {
            float: left;
            height: 240px;
            width: 424px;
            margin-top: 10px;
        }
        #FormContatos .FormCadastroContatos
        {
            float: left;
            width: 452px;
            height: 307px;
        }
        .invisible
        {
            display: none;
        }
        .btnAddContato
        {
            height: 63px;
        }
    </style>
</head>
<body>
     <form id="form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server"/>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

    <div id="FormContatos">
    
     <div class="FormCadastroContatos">

         <fieldset style="height: 282px">
             <legend>Cadastrar Contatos</legend>
         
         <asp:TextBox ID="txtCodigo" CssClass="invisible" runat="server" ReadOnly="True" Width="50px" />

         <asp:Label ID="lblNomeContatoTXT" runat="server" Text="Nome:"></asp:Label> <br />
         <asp:TextBox ID="txtNome" runat="server" Width="200px" MaxLength="50" />
         <asp:RequiredFieldValidator ID="requireNome" runat="server" 
         ControlToValidate="txtNome" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Campo requerido." ValidationGroup="Salvar">
         </asp:RequiredFieldValidator>
         <br />

         <asp:Label ID="lblTelefoneTXT" runat="server" Text="Telefone:"></asp:Label> <br />
         <asp:TextBox ID="txtTelefone" runat="server" Width="150px" MaxLength="15" />
         <asp:RequiredFieldValidator ID="requireTelefone" runat="server" 
         ControlToValidate="txtTelefone" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Campo requerido." ValidationGroup="Salvar">
         </asp:RequiredFieldValidator>
         <br />

         <asp:Label ID="lblCargoTXT" runat="server" Text="Cargo:"></asp:Label> <br />
         <asp:TextBox ID="txtCargo" runat="server" Width="150px" MaxLength="20" />
         <asp:RequiredFieldValidator ID="requireCargo" runat="server" 
         ControlToValidate="txtCargo" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Campo requerido." ValidationGroup="Salvar">
         </asp:RequiredFieldValidator>
         <br />

         <asp:Label ID="lblEmailTXT" runat="server" Text="Email:"></asp:Label> <br />
         <asp:TextBox ID="txtEmail" runat="server" Width="200px" MaxLength="50" />
         <asp:RequiredFieldValidator ID="requireEmail" runat="server" 
         ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Campo requerido." ValidationGroup="Salvar">
         </asp:RequiredFieldValidator>
         <asp:RegularExpressionValidator ID="regularEmail" runat="server" 
         ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Email inválido." 
         ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
         ValidationGroup="Salvar">
         </asp:RegularExpressionValidator>
         <br /><br />

         <asp:Label ID="lblSupplierTXT" runat="server" Text="Supplier:"></asp:Label>&nbsp;
         <asp:Label ID="lblSupplier" runat="server" Font-Size="Small"></asp:Label>
         <br /><br />

        <div class="btnAddContato">
             <asp:Button ID="btnNovoContato" CssClass="btnsGeral" runat="server" Text="Salvar" ValidationGroup="Salvar" onclick="SalvarContato" />
             <asp:Button ID="btnUpdateContato" CssClass="btnsGeral" runat="server" onclick="EditarContato" Text="Atualizar" ValidationGroup="Salvar" />
             <asp:Button ID="btnExcluirContato" CssClass="btnsGeral" runat="server" onclick="ExcluirContato" Text="Excluir" />
             <asp:Button ID="btnLimpar" CssClass="btnsGeral" runat="server" Text="Limpar" onclick="Limpar"/>
             <asp:Button ID="btnFechar" CssClass="btnsGeral" runat="server" OnClientClick="window.close();" Text="Fechar"/>
             <br />         
             <asp:Label ID="lblMsgAddContato" runat="server" Font-Bold="True" ForeColor="#CC0000" Font-Size="Small"></asp:Label>
        </div>

       </fieldset>
    </div>

    <div class="GridContatos">
    

        <asp:GridView ID="GridContatos" runat="server" AllowPaging="True"
         AutoGenerateColumns="False" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr"
           AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="PaginarDados" EmptyDataText="Não existe contato para esse Supplier."
            Height="16px" onselectedindexchanged="GridContatos_SelectedIndexChanged" PageSize="8" >
           <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>

           <Columns>
           <asp:BoundField DataField="SCONT_id" HeaderText="ID" ReadOnly="True" 
                     SortExpression="SCONT_id" InsertVisible="False"  
                     FooterStyle-CssClass="invisible"
                     HeaderStyle-CssClass="invisible" 
                     ItemStyle-CssClass="invisible">

                 <FooterStyle CssClass="invisible" />
               <HeaderStyle CssClass="invisible" />
               <ItemStyle CssClass="invisible" />
               </asp:BoundField>

                 <asp:BoundField DataField="SCONT_nome" HeaderText="Nome" 
                     SortExpression="SCONT_nome"/>

                      <asp:BoundField DataField="SCONT_telefone" HeaderText="Telefone" 
                     SortExpression="SCONT_telefone"/>

                      <asp:BoundField DataField="SCONT_position" HeaderText="Cargo" 
                     SortExpression="SCONT_position"/>

                     <asp:BoundField DataField="SCONT_email" HeaderText="Email" 
                     SortExpression="SCONT_email"/>
                     

                 <asp:CommandField HeaderText="Editar" SelectText="Editar" 
                     ShowSelectButton="True" />
        </Columns>

        <PagerStyle CssClass="pgr"></PagerStyle>

        </asp:GridView>
    
    </div>

      </div>

     </ContentTemplate>
     </asp:UpdatePanel>
    
    </form>
</body>
</html>
